/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package homework7;

/**
 *
 * @author Administrator
 */
import java.util.*;
public class MainG{ 
    public static void main(String []args){
        String str,str1;
        int a,m=1,n;
        Scanner reader = new Scanner(System.in);
        a=reader.nextInt();
        reader.nextLine();
        for(int i=0;i<a;i++){           
            str=reader.nextLine();
            str=str.toUpperCase();
            String[] s=str.split(" ");
            for(int j=0;j<s.length;j++){
                str1=s[j];
                if(!"".equals(str1))
                    System.out.print(str1.charAt(0));
            }
            System.out.println("");
        }       
    }
}
